package com.base.service;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.base.po.sqlparam.RechargeablecardsExamplePage;
import com.base.po.voip.Rechargeablecards;
import com.base.po.voip.RechargeablecardsExample;
import com.base.utils.Page;

public interface RechargeablecardsService {
	int countByExample(RechargeablecardsExample example);

	int deleteByExample(RechargeablecardsExample example);

	int deleteByPrimaryKey(String id);

	int insert(String cardno, String pwd, Integer money, String parentid, Integer status, Integer termofvalidity,
               Integer probationperiod, String feelroute, Boolean datastatus, String batch, Date usetime, String mobile,
               String picpath, Integer type, String number);

	int insertCards(List<Rechargeablecards> example);

	int insertSelective(Rechargeablecards record);

	List<Rechargeablecards> selectByExample(RechargeablecardsExample example);

	List<Rechargeablecards> selectByExamplePage(RechargeablecardsExamplePage example);
	
	List<Rechargeablecards> selectByCardNo(@Param("cardno") String cardno);
	
	List<Rechargeablecards> selectByAll(@Param("page") Page page, @Param("status") Integer status,
                                        @Param("batch") String batch, @Param("money") Integer money, @Param("mobile") String mobile,
                                        @Param("parentid") String parentid, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
                                        @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
                                        @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute);
	
	List<Rechargeablecards> selectByParentid(@Param("page") Page page, @Param("parentid") String parentid, @Param("status") Integer status,
                                             @Param("batch") String batch, @Param("money") Integer money, @Param("mobile") String mobile,
                                             @Param("id") String id, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
                                             @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
                                             @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute);
	
	List<Rechargeablecards> selectByShopid(@Param("page") Page page, @Param("shopid") String shopid, @Param("status") Integer status,
                                           @Param("batch") String batch, @Param("money") Integer money, @Param("mobile") String mobile,
                                           @Param("id") String id, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
                                           @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
                                           @Param("datastatus") Boolean datastatus);
	
	List<Rechargeablecards> selectByShopidNotAll(@Param("page") Page page, @Param("shopid") String shopid, @Param("status") Integer status,
                                                 @Param("batch") String batch, @Param("money") Integer money, @Param("mobile") String mobile,
                                                 @Param("id") String id, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
                                                 @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
                                                 @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute);

	Rechargeablecards selectByPrimaryKey(String id);

	String selectMaxCardNo();

	List<Rechargeablecards> selectCard(@Param("parentid") String parentid, @Param("batch") String batch);

	int updateByExampleSelective(@Param("record") Rechargeablecards record,
                                 @Param("example") RechargeablecardsExample example);

	int updateByExample(@Param("record") Rechargeablecards record, @Param("example") RechargeablecardsExample example);

	int updateByPrimaryKeySelective(Rechargeablecards record);

	int updateByPrimaryKey(Rechargeablecards record);
	
	int countByAll(@Param("status") Integer status, @Param("batch") String batch, @Param("money") Integer money,
                   @Param("mobile") String mobile, @Param("parentid") String parentid, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
                   @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
                   @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute);
	
	int countByParentid(@Param("parentid") String parentid, @Param("status") Integer status, @Param("batch") String batch, @Param("money") Integer money,
                        @Param("mobile") String mobile, @Param("id") String id, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
                        @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
                        @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute);
	
	int countByShopid(@Param("shopid") String shopid, @Param("status") Integer status, @Param("batch") String batch, @Param("money") Integer money,
                      @Param("mobile") String mobile, @Param("id") String id, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
                      @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
                      @Param("datastatus") Boolean datastatus);
	
	int countByShopidNotAll(@Param("shopid") String shopid, @Param("status") Integer status, @Param("batch") String batch, @Param("money") Integer money,
                            @Param("mobile") String mobile, @Param("id") String id, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
                            @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
                            @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute);

	int updateByCardNo(@Param("parentId") String parentId, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo);

    int countByParentidusetime(@Param("parentid") String parentid, @Param("status") Integer status, @Param("batch") String batch, @Param("money") Integer money,
								   @Param("mobile") String mobile, @Param("id") String id, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
								   @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
								   @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute,@Param("usetime1") Date usetime1,@Param("usetime2") Date usetime2);

	List<Rechargeablecards> selectByParentidusetime(@Param("page") Page page, @Param("parentid") String parentid, @Param("status") Integer status,
													@Param("batch") String batch, @Param("money") Integer money, @Param("mobile") String mobile,
													@Param("id") String id, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
													@Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
													@Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute,@Param("usetime1") Date usetime1,@Param("usetime2") Date usetime2);

	List<String> selectCardsCountBymoney(@Param("userid") String userid, @Param("usetime1") String usetime1, @Param("usetime2") String usetime2);

	List<Rechargeablecards> selectByAllNotOrder(Page page, Integer sStatus, String sBatch, Integer sMoney, String sMobile, String pId, String sCardno, Integer sTermofvalidity, Integer sProbationperiod, String sCardnoFrom, String sCardnoTo, Boolean sDatastatus, Integer sType, String sFeelroute);

    int batchAddCards(List<Rechargeablecards> list);

    int countByAllNew(@Param("status") Integer status, @Param("batch") String batch, @Param("money") Integer money,
					  @Param("mobile") String mobile, @Param("parentid") List<String> parentid, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
					  @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
					  @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute);

	List<Rechargeablecards> selectByAllNew(@Param("page") Page page, @Param("status") Integer status,
										   @Param("batch") String batch, @Param("money") Integer money, @Param("mobile") String mobile,
										   @Param("parentid") List<String> parentid, @Param("cardno") String cardno, @Param("termofvalidity") Integer termofvalidity,
										   @Param("probationperiod") Integer probationperiod, @Param("cardnoFrom") String cardnoFrom, @Param("cardnoTo") String cardnoTo,
										   @Param("datastatus") Boolean datastatus, @Param("type") Integer type, @Param("feelroute") String feelroute);
	/**
	 *  @Date: 2020/5/16 11:59
	 *  @Description:
	 *  专门给充值卡使用的，该接口是查询卡是否能够充值
	 */
    List<Rechargeablecards> selectByCPS(String cardno, String pwd, int status);

	String selectMaxCards(String sBatch);

	String selectMinCards(String sBatch);

    int updateBatchAndCardsBetween(String batch, String cardnoFrom, String cardnoTo, String userid);
}
